package com.example.hrsystem.workflow.repository;

import com.example.hrsystem.workflow.model.NodeExecution;
import com.example.hrsystem.workflow.model.ProcessDefinition;
import com.example.hrsystem.workflow.model.ProcessInstance;
import com.example.hrsystem.workflow.model.WorkflowTask;

import java.util.List;

/**
 * 工作流数据访问仓库接口
 * 定义工作流相关数据的访问方法
 */
public interface WorkflowRepository {
    // ProcessDefinition 相关方法
    ProcessDefinition getProcessDefinitionById(int id);
    List<ProcessDefinition> getAllProcessDefinitions();
    void saveProcessDefinition(ProcessDefinition processDefinition);
    void updateProcessDefinition(ProcessDefinition processDefinition);
    void deleteProcessDefinition(int id);

    // ProcessInstance 相关方法
    ProcessInstance getProcessInstanceById(int id);
    List<ProcessInstance> getProcessInstancesByDefinitionId(int processDefinitionId);
    List<ProcessInstance> getProcessInstancesByInitiator(int initiatorId);
    void saveProcessInstance(ProcessInstance processInstance);
    void updateProcessInstance(ProcessInstance processInstance);
    void deleteProcessInstance(int id);

    // WorkflowTask 相关方法
    WorkflowTask getTaskById(int id);
    List<WorkflowTask> getTasksByProcessInstance(int processInstanceId);
    List<WorkflowTask> getTasksByAssignee(int assigneeId);
    List<WorkflowTask> getTasksByStatus(String status);
    void saveTask(WorkflowTask task);
    void updateTask(WorkflowTask task);
    void deleteTask(int id);

    // NodeExecution 相关方法
    NodeExecution getNodeExecutionById(int id);
    List<NodeExecution> getNodeExecutionsByProcessInstance(int processInstanceId);
    void saveNodeExecution(NodeExecution nodeExecution);
    void updateNodeExecution(NodeExecution nodeExecution);
    void deleteNodeExecution(int id);
}